<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title></title>
		<meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">
		<link rel="stylesheet" type="text/css" href="<c:url value="/static/jquery-easyui/themes/default/easyui.css"/>">
		<link rel="stylesheet" type="text/css"
			href="<c:url value="/static/jquery-easyui/themes/icon.css"/>">
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/jquery-1.6.min.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/jquery.easyui.min.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/plugins/jquery.panel.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/plugins/jquery.datagrid.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/plugins/jquery.messager.js"/>"></script>
		<script type="text/javascript"
			src="<c:url value="/static/jquery-easyui/ext-for-framework.js.jsp"/>"></script>
		<script type="text/javascript" src="<c:url value="/static/jquery-easyui/locale/easyui-lang-zh_CN.js"/>"></script>	
		<script type="text/javascript"
			src="<c:url value="/static/js/common.js"/>"></script>			
		<script>
		
			function initList(listDisplayEId) {
				$('#' + listDisplayEId).datagrid(
						{
							nowrap : false,
							striped : true,
							collapsible : true,
							remoteSort : true,
							notSelectByRow : false,
							toolbar : [
									
									],
							onLoadError:function(){
								$.messager.alert('错误','获取数据失败，请与管理员联系！','error');
							}
						 
						});
			};
			$(document).ready(function() {
				initList('listDisplay');
			});
			 
            function searchInfo(){
                    $('#listDisplay').datagrid('load', {
                    	custName : $('#custName').val(),
                    	turnoverDate : $('#turnoverDate').val()
                    }); 
                
            }
            function tea(){
            	$('#listDisplay').datagrid('load');  
            }
            
            // 种类格式
            var turnoverTypeClass;
            $.ajax({
                async : false,
                url : "<c:url value='/turnover/turnoverTypePullDown.do?space=0'/>",
                type : "post",
                data : {
                    turnoverType : 1
                },
                success : function(data) {
                    turnoverTypeClass = data;
                    if(typeof(turnoverTypeClass)=='string'){
                        turnoverTypeClass =JSON.parse(turnoverTypeClass);
                    }
                }
            });
            //设置种类
            function formatTurnoverType(value, row, index, field) {
                for (var i = 0; i < turnoverTypeClass.length; i++) {
                    if (value == turnoverTypeClass[i].turnoverType) {
                        return turnoverTypeClass[i].turnoverTypeName;
                    }
                }
                return "无";
            }
		</script>
			</head>
			<body>
			<table width="98%">
			<tr><td>
            <div style="height: auto; width:1180px;background: #fafafa; padding: 5px;" class="easyui-panel" title="查询" iconCls="icon-search" collapsible="true" minimizable="false" maximizable="false" closable="false">
                    <form id="searchForm" name="searchForm" method="post" >
                        <div>
                        <table cellpadding="5">
                                <tr>
                                    <td>客户名：</td>
                                    <td><input class="easyui-validatebox" id="custName" editable="true" name="custName"></input></td>
                                    <td>初始日期：</td>
                                    <td><input class="easyui-validatebox" id="turnoverDateStart" editable="true" name="turnoverDate"></input></td>
                                    <td>结束日期：</td>
                                    <td><input class="easyui-validatebox" id="turnoverDateEnd" editable="true" name="turnoverDate"></input></td>
                                    <td><input type="button" onclick="searchInfo()" value="查询"></td>
                                </tr>
                        </table>                     
                        </div>
                    </form>
                </div>
            </td></tr>
			<tr>
			<td>
				<table id="listDisplay" title="营业额列表" 
				iconCls="icon-list" singleSelect="true" idField="turnoverId"
				url="<c:url value="/turnover/listTurnoverList.do"/>" loadMsg="请稍候......"
				pagination="true" pageSize="20"
				pageList="[10,20,30,40,50]" 
				rownumbers="true" sortOrder="asc">
				<thead>
				<tr>
				    <th field="id" width="25" align="center" checkbox="true" >
					</th> 
				    <th field="turnoverId" width="80" sortable="true" >ID
					</th>	
 					<th field="custId" width="80" sortable="true" >客户ID
					</th>
					<th field="custName" width="80" sortable="true" >客户名
                    </th>
                    <th field="turnoverType" width="100" sortable="true" formatter="formatTurnoverType">类型
                    </th>  
                    <th field="turnoverValue" width="100" sortable="true" >营业额
                    </th>   
					<th field="turnoverState" width="80"  sortable="true"  formatter="formaterTurnoverState">状态
					</th>	
					<th field="turnoverDate" width="80"  sortable="true" >日期
                    </th>   
 				</tr>
				</thead>
			</table>
			</td>
			</tr>
		</table>
	</body>
</html>